
function isPow4(num) {
  let str = num.toString(4)
  if (str[0] == 0) {
    return false
  } else {
    for(let i=1, len = str.length; i<len-1; ++i) {
      if(str[i]!=0) return false;
    }
  }
  return true;
}

var isPowOf4 = function(num) {
  let str = num.toString(4)
  return /^1(0)*$/.test(str)
}

console.log(isPowOf4(64))
